package com.wngbms._02_invoke;

public class InvokeTest {
    
    public static void fun1() {

    }

    public void fun2() {
        fun3();
        getClass();
    }

    private void fun3() {
        super.getClass();
    }

    public static void main(String[] args) {
        InvokeTest test = new InvokeTest();
        fun1();
        test.fun2();
        test.fun3();

        IIF iif = new F();
        iif.f();

        F f = new F();
        f.f();
        f.f2();
        f.f3();
        f.f5(x -> "hello");

        iif.ff();
        f.ff();
    }
}

/**
 * PS D:\Code\_01_geektime\_01_geektime> javap -c .\bin\com\wngbms\InvokeTest.class                                                                    Compiled from "InvokeTest.java"
public class com.wngbms.InvokeTest {
  public com.wngbms.InvokeTest();
    Code:
       0: aload_0
       1: invokespecial #8                  // Method java/lang/Object."<init>":()V                             # 调用父类构造方法          invokespecial
       4: return

  public static void fun1();
    Code:
       0: return

  public void fun2();
    Code:
       0: aload_0
       1: invokespecial #16                 // Method fun3:()V                                                  # 调用同一个类private方法   invokespecial
       4: aload_0
       5: invokevirtual #19                 // Method java/lang/Object.getClass:()Ljava/lang/Class;             
       8: pop
       9: return

  public static void main(java.lang.String[]);
    Code:
       0: new           #1                  // class com/wngbms/InvokeTest
       3: dup
       4: invokespecial #25                 // Method "<init>":()V                                               # 调用构造方法         invokespecial
       7: astore_1
       8: invokestatic  #26                 // Method fun1:()V                                                   # 调用静态方法         invokestatic
      11: aload_1
      12: invokevirtual #28                 // Method fun2:()V
      15: aload_1
      16: invokespecial #16                 // Method fun3:()V                                                    # 调用私有方法        invokespecial
      19: new           #30                 // class com/wngbms/F
      22: dup
      23: invokespecial #32                 // Method com/wngbms/F."<init>":()V
      26: astore_2
      27: aload_2
      28: invokeinterface #33,  1           // InterfaceMethod com/wngbms/IIF.f:()V                             # 通过接口引用调用方法. invokeinterface
      33: new           #30                 // class com/wngbms/F
      36: dup
      37: invokespecial #32                 // Method com/wngbms/F."<init>":()V
      40: astore_3
      41: aload_3
      42: invokevirtual #38                 // Method com/wngbms/F.f:()V
      45: aload_3
      46: invokevirtual #39                 // Method com/wngbms/F.f2:()V
      49: aload_3
      50: invokevirtual #42                 // Method com/wngbms/F.f3:()V
      53: aload_3
      54: invokedynamic #45,  0             // InvokeDynamic #0:apply:()Ljava/util/function/Function;               # Lambda 表达式  invokedynamic
      59: invokevirtual #49                 // Method com/wngbms/F.f5:(Ljava/util/function/Function;)V
      62: return
}
PS D:\Code\_01_geektime\_01_geektime> 
 */

/**
 * Compiled from "InvokeTest.java"
public class com.wngbms.InvokeTest {
  public com.wngbms.InvokeTest();
    Code:
       0: aload_0
       1: invokespecial #8                  // Method java/lang/Object."<init>":()V
       4: return

  public static void fun1();
    Code:
       0: return

  public void fun2();
    Code:
       0: aload_0
       1: invokespecial #16                 // Method fun3:()V                                   // 调用同一个类中的private方法
       4: return

  public static void main(java.lang.String[]);
    Code:
       0: new           #1                  // class com/wngbms/InvokeTest
       3: dup
       4: invokespecial #25                 // Method "<init>":()V                               // 调用构造方法
       7: astore_1
       8: invokestatic  #26                 // Method fun1:()V                                   // 调用静态方法
      11: aload_1
      12: invokevirtual #28                 // Method fun2:()V                                   // 调用目标对象public, protected, default方法
      15: new           #30                 // class com/wngbms/F
      18: dup
      19: invokespecial #32                 // Method com/wngbms/F."<init>":()V
      22: astore_2
      23: aload_2
      24: invokeinterface #33,  1           // InterfaceMethod com/wngbms/IIF.f:()V                // 通过接口引用调用方法.
      29: return
}
 */